package com.szholly.data.general.metadata.table;

import com.szholly.data.general.*;

/**
 * 类功能说明 定义表关系实体
 */
public class TableRelationRow extends RowBase {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5563539575921445096L;

	/**
	 * 父表
	 */
	public final static String FIELD_PTABLEID = "S_PTABLEID";

	/**
	 * 子表
	 */
	public final static String FIELD_CTABLEID = "S_CTABLEID";

	/**
	 * 父表外键关系
	 */
	public final static String FIELD_FOREIGNKEY = "S_FOREIGNKEY";

	/**
	 * 关联类型
	 */
	public final static String FIELD_RELATIONTYPE = "I_RELATIONTYPE";

	/**
	 * 关联强度
	 */
	public final static String FIELD_RELATIONSTRENGTH = "I_RELATIONSTRENGTH";

	/**
	 * 父表
	 */
	public String getPTableID() {
		return (String) getValue(GlobalDataType.String,FIELD_PTABLEID);
	}

	public void setPTableID(String value) {
		setValue(FIELD_PTABLEID, value);
	}

	/**
	 * 子表
	 */
	public String getCTableID() {
		return (String) getValue(GlobalDataType.String,FIELD_CTABLEID);
	}

	public void setCTableID(String value) {
		setValue(FIELD_CTABLEID, value);
	}

	/**
	 * 表外键关系
	 */
	public String getForeignKey() {
		return (String) getValue(GlobalDataType.String,FIELD_FOREIGNKEY);
	}

	public void setForeignKey(String value) {
		setValue(FIELD_FOREIGNKEY, value);
	}

	/**
	 * 关联类型
	 */
	public int getRelationType() {
		Integer result = 0;
		try{
			result = (Integer)getValue(GlobalDataType.Int32,FIELD_RELATIONTYPE);
		}catch(Exception e){
			
		}
		return result.intValue();
	}

	public void setRelationType(String value) {
		setValue(FIELD_RELATIONTYPE, value);
	}

	/**
	 * 关联强度
	 */
	public int getRelationStrength() {
		Integer result = 0;
		try{
			result = (Integer)getValue(GlobalDataType.Int32,FIELD_RELATIONSTRENGTH);
		}catch(Exception e){
			
		}
		return result.intValue();
	}

	public void setRelationStrength(int value) {
		setValue(FIELD_RELATIONSTRENGTH, value);
	}

	public static String getPTableID(RowBase entity) {
		return (String)entity.getValue(GlobalDataType.String, FIELD_PTABLEID);
	}

	public static String getCTableID(RowBase entity) {
		return (String)entity.getValue(GlobalDataType.String, FIELD_CTABLEID);
	}

	public static String getForeignKey(RowBase entity) {
		return (String)entity.getValue(GlobalDataType.String, FIELD_FOREIGNKEY);
	}

	public static int getRelationStrength(RowBase entity) {
		return (Integer)entity.getValue(GlobalDataType.Int32, FIELD_RELATIONSTRENGTH);
	}

	public static int getRelationType(RowBase entity) {
		return (Integer)entity.getValue(GlobalDataType.Int32, FIELD_RELATIONTYPE);
	}

}